Index: lib/libz/deflate.c
===================================================================
RCS file: /home/ncvs/src/lib/libz/deflate.c,v
retrieving revision 1.5
diff -u -r1.5 deflate.c
--- lib/libz/deflate.c	28 Aug 1999 00:06:01 -0000	1.5
+++ lib/libz/deflate.c	21 Mar 2002 01:57:47 -0000
@@ -242,7 +242,7 @@
         windowBits = -windowBits;
     }
     if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
-        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
+        windowBits < 9 || windowBits > 15 || level < 0 || level > 9 ||
 	strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
         return Z_STREAM_ERROR;
     }
Index: sys/net/zlib.c
===================================================================
RCS file: /home/ncvs/src/sys/net/zlib.c,v
retrieving revision 1.10.4.1
diff -u -r1.10.4.1 zlib.c
--- sys/net/zlib.c	23 Feb 2002 00:16:14 -0000	1.10.4.1
+++ sys/net/zlib.c	21 Mar 2002 01:57:47 -0000
@@ -776,7 +776,7 @@
         windowBits = -windowBits;
     }
     if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
-        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
+        windowBits < 9 || windowBits > 15 || level < 0 || level > 9 ||
 	strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
         return Z_STREAM_ERROR;
     }
@@ -3951,11 +3951,15 @@
           r = Z_MEM_ERROR;
           LEAVE
         }
+	/*
+	 * this ZFREE must occur *BEFORE* we mess with sub.decode, because
+	 * sub.trees is union'd with sub.decode.
+	 */
+        ZFREE(z, s->sub.trees.blens);
         s->sub.decode.codes = c;
         s->sub.decode.tl = tl;
         s->sub.decode.td = td;
       }
-      ZFREE(z, s->sub.trees.blens);
       s->mode = CODES;
     case CODES:
       UPDATE
